<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%--引入标准标签库
    prefix:简短名称
    uri:标签库

--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>>
<html>
<head>
    <title>JSTL</title>
</head>
    <body>
        <%--向域对象中添加成绩数据--%>

    ${pageContext.setAttribute("score","T")}

    <%--对成绩进行判断--%>
    <c:if test="true">
        优秀
    </c:if>


    <%--对成绩进行多条判断--%>
    <c:choose>
        <c:when test="{score eq 'A'}">优秀</c:when>
        <c:when test="{score eq 'B'}">良好</c:when>
        <c:when test="{score eq 'C'}">及格</c:when>
        <c:when test="{score eq 'D'}">较差</c:when>
        <c:otherwise>成绩非法</c:otherwise>

    </c:choose>


    <%--遍历--%>
    <%String[] strs = {"a","b","c"};
    pageContext.setAttribute("strs",strs);

    %>  <%--  items用于接收数组或集合数据
                            var用于接收遍历的元素  --%>
    <c:forEach items="${strs}" var="s">
        ${s}  <br/>

    </c:forEach>
    <%--begin起始索引   end结束索引     step步调(间隔取值)      --%>
    <c:forEach begin="1" end="10" var="c" step="2">
        ${c}    <br/>

    </c:forEach>


    </body>
</html>
